var mongoose = require("mongoose");
var Schema = mongoose.Schema;

var users_schema = new Schema({
    username:String,
    password:String,
    age:Number,
    time:Date,
    nickname:String,
    mobile:String
})

var mvs_schema = new Schema({
    "genres":Array,
    "casts": Array,
    "directors": Array,
    "rating": Object,
    "title": String,
    "collect_count": Number,
    "original_title":String,
    "subtype": String,
    "year": String,
    "images": Object,
    "alt":String,
    "id":String
})

var prouser1_schema = new Schema({
   mobile:String,
   username:String,
   password:String,
   roleid:String,
   time:Date
})
// Model 对象模型  集合对象模型 
// model 是 schema 生成的 模型  可以对数据库的集合进行操作 
//  mongoose.model("集合名称",schemaName)
// 英语复数 
// my ===>  db.mies 
// like ==> db.likes 
// users ==> db.users
// user1 ==> db.user1 
exports.User = mongoose.model("userinfo0",users_schema);

exports.Mvs = mongoose.model("movies",mvs_schema);


var comment_schema = new Schema({
   title:String,
   content:String,
   author:String,
   time:String,
   mid:String,
   movie:Object,
   answer:Array
})


exports.Comment = mongoose.model("comments",comment_schema);

exports.Prouser = mongoose.model("prouser1",prouser1_schema)


// 个人体温记录 
var tiwen1_schema = new Schema({
    mobile:String,
    username:String,
    time:Date,
    tiwen:Number,
    ishei:String,  
    is_yin:String  // 1 阴性  0. 阳性  
 })

 exports.Tiwen = mongoose.model("tiwen1",tiwen1_schema);

 // 意见记录 
var advise1_schema = new Schema({
    mobile:String,
    username:String,
    time:Date,
    title:String,
    content:String,
    category:String,
    reply:Array,
 })


 exports.Advise = mongoose.model("advise1",advise1_schema);

 
 var good_schema = new Schema({
    "name" : String, 
    "price" :Number, 
    "discount" : Number, 
    "img" : String,
    "type" : Object
 })

 exports.Goods = mongoose.model("goods",good_schema);

 
 var cart_schema = new Schema({
   "mobile":String,
   good:Object,
   goodId:String,
   count:Number,
   time:Date,
   checked:Boolean
})

exports.Cart = mongoose.model("cart1",cart_schema);


var userinfo1_schema = new Schema({
   mobile:String,
   username:String,
   password:String,
   roleid:String,
   time:Date,
   times:Date,
   show:Boolean,
   avatar:String
})

exports.Userinfo = mongoose.model("userinfo1", userinfo1_schema);

var leave_schema = new Schema({
   mobile:String,
   username:String,
   roleid:String,
   time1:String,
   time2:String,
   category:Array,
   flag:String,
   desc:String
})

exports.Leave = mongoose.model("leave1", leave_schema);

// 意见记录 
var advise2_schema = new Schema({
   mobile:String,
   username:String,
   time:Date,
   title:String,
   content:String,
   category:String, 
   reply:Array,
})


exports.Adviss = mongoose.model("advise2",advise2_schema);

var approval1_schema = new Schema({
   mobile:String,
   username:String,
   time1:String,
   time2:String,
   category:Array,
   flag:String,
   desc:String
})


exports.Approval = mongoose.model("approval1",approval1_schema);